<?php
$params = array_merge(
    require(__DIR__ . '/../../common/config/params.php'),
    require(__DIR__ . '/../../common/config/params-local.php'),
    require(__DIR__ . '/params.php'),
    require(__DIR__ . '/params-local.php')
);

return [
    'id' => 'app-backend',
    'name' => '易商金融接口管理后台',
    'basePath' => dirname(__DIR__),
    'language' => 'zh-CN',
    'controllerNamespace' => 'backend\controllers',
    'bootstrap' => ['log'],
    'modules' => [
        'admin' => [
            'class' => \mdm\admin\Module::className(),
            'controllerMap' => [
                'assignment' => [
                    'class' => 'mdm\admin\controllers\AssignmentController',
                    'userClassName' => \backend\models\User::className(),
                    'idField' => 'user_id',
                    'usernameField' => 'username',
                    'extraColumns' => [
                        'phone',
                        'email',
                        [
                            'label' => 'created_at',
                            'format' => ['date', 'php:Y-m-d H:i:s'],
                            'value' => function ($model) {
                                return $model->created_at;
                            }
                        ],
                        [
                            'label' => 'updated_at',
                            'format' => ['date', 'php:Y-m-d H:i:s'],
                            'value' => function ($model) {
                                return $model->created_at;
                            }
                        ],
                    ],
                    'searchClass' => 'backend\models\UserSearch',
                ],
            ],
            'layout' => 'left-menu',
            'mainLayout' => '@app/views/layouts/main.php',
            'menus' => [
                'assignment' => [
                    'label' => '用户授权' // change label
                ],
                'user' => null, // disable menu
            ],
        ],
        'gridview' => [
            'class' => \kartik\grid\Module::className(),
            // see settings on http://demos.krajee.com/grid#module
        ],
        'datecontrol' => [
            'class' => \kartik\datecontrol\Module::className(),
            // see settings on http://demos.krajee.com/datecontrol#module
        ],
        // If you use tree table
        'treemanager' =>  [
            'class' => \kartik\tree\Module::className(),
            // see settings on http://demos.krajee.com/tree-manager#module
        ],
        'dynagrid'=>[
            'class'=>\kartik\dynagrid\Module::className(),
            // other settings (refer documentation)
        ],
        'user' => [ // 用户
            'class' => \backend\modules\user\Module::className(),
        ],
        'api' => [ // 接口
            'class' => \backend\modules\api\Module::className(),
        ],
	    'basic' => [ // 基础信息
		    'class' => 'backend\modules\basic\BasicModule',
	    ],
	    'bind' => [ // 业务绑定
	    	'class' => 'backend\modules\bind\BindModule',
	    ],
        'credit' => [ // 征信管理
            'class' => 'backend\modules\credit\CreditModule',
        ],
        'logs' => [ // 日志信息
            'class' => 'backend\modules\logs\LogsModule',
        ],
        'special_card' => [ // 专项卡管理
            'class' => \backend\modules\special_card\SpecialCardModule::className(),
        ],
        'car_order' => [ // 车辆业务
            'class' => 'backend\modules\car_order\CarOrderModule',
        ],
        'proxy_pay' => [ // 代付业务
            'class' => \backend\modules\proxy_pay\ProxyPayModule::className(),
        ],
        'android_app_versions' => [ // 安卓app版本管理
            'class' => \backend\modules\android_app_versions\AndroidAppVersionsModule::className(),
        ],
        'bigdata_bairong' => [ // 百融信息查询
            'class' => \backend\modules\bigdata_bairong\BigdateBairong::className(),
        ],
        'bigdata_fico_early_warning' => [ // fico信息查询
            'class' => \backend\modules\bigdata_fico_early_warning\FicoEarlyWarning::className(),
        ],
        'jzg' => [ // 精真估
            'class' => \backend\modules\jzg\JzgModule::className(),
        ],
    ],
    'components' => [
        'authManager' => [
            'class' => \yii\rbac\DbManager::className(),
        ],
        /*'assetManager' => [
            'converter' =>
                [
                    'class' => \singrana\assets\Converter::className(),
                ],
        ],*/
        'urlManager' => [
            'enablePrettyUrl' => true,
//            'showScriptName' => false,
            'rules' => [
            ],
        ],
        'request' => [
            'csrfParam' => '_csrf-backend',
        ],
        'user' => [
            'identityClass' => 'common\models\User',
            'enableAutoLogin' => true,
            'identityCookie' => ['name' => '_identity-backend', 'httpOnly' => true],
        ],
        'session' => [
            // this is the name of the session cookie used for login on the backend
            'name' => 'advanced-backend',
        ],
        /*'log' => [
            'traceLevel' => YII_DEBUG ? 3 : 0,
            'targets' => [
                [
                    'class' => 'yii\log\FileTarget',
                    'levels' => ['error', 'warning'],
                ],
            ],
        ],*/
        'errorHandler' => [
            'errorAction' => 'site/error',
        ],
    ],
    'as access' => [
        'class' => \mdm\admin\components\AccessControl::className(),
        'allowActions' => [
            'site/*',
        ],
    ],
    'params' => $params,
];
